import re
import time
import json
from django.http import HttpResponse
from .mssqlclient import TMsSql
from .utils import TUtils
from .utils import TRequestResult
class THhag:
    def __init__(self) -> None:
        self.mssqlClient =  TMsSql()
    def query(self , request):
        res = TRequestResult()
        try:
            data = TUtils.getRequestData(request)
            reqPs = data['ps']
            dbKey = reqPs["d"]
            dbPath = reqPs["k"]
            dbPs = reqPs["p"]
            dbRes = self.mssqlClient.query( dbKey , dbPath , dbPs)      
            res.result = dbRes      
            print(dbRes)
        except Exception as er:
            print(er)
        respData =  res.toJson()
        return HttpResponse(respData) 
hhag = THhag()
    